package com.fadadianqi.mall.product.dao.ibatis;

import com.fadadianqi.commons.BaseDAO;
import com.fadadianqi.commons.GenericDAOSuport;
import com.fadadianqi.mall.product.dao.AttrValDAO;
import com.fadadianqi.mall.product.model.AttrName;
import com.fadadianqi.mall.product.model.AttrVal;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by aroot on 2/12/14.
 */
@Component
public class AttrValDAOImpl extends GenericDAOSuport<String, AttrVal> implements AttrValDAO {
    @Override
    protected Class<?> getObjectClass() {
        return AttrVal.class;
    }

    @Override
    protected String getTableName() {
        return "mall_attr_val";
    }

    @Override
    public AttrVal getByVal(String val) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("val", val);
        return super.getByPropertys(map);
    }

    @Override
    public List<AttrVal> findByAttrNameId(String attrNameId) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("attrNameId", attrNameId);
        return super.findByPropertys(map);
    }
}
